Skip to content

feat(specifiers): add diagnostic decision-support workspace#633

Merged
BigSimmo merged 8 commits into
mainfrom
codex/specifiers-design
Jul 13, 2026
Merged

feat(specifiers): add diagnostic decision-support workspace#633
BigSimmo merged 8 commits into
mainfrom
codex/specifiers-design

Conversation

@BigSimmo

@BigSimmo BigSimmo commented Jul 13, 2026

Copy link
Copy Markdown
Owner

Summary

  • add Specifiers as a first-class Clinical Guide mode using the shared desktop sidebar, core header, mobile header, and bottom search composer
  • add fully local natural-language specifier search with 12 structured records, diagnosis/family filtering, detail guidance, comparison, wording builder, and relationship map
  • remove Source and Source status from the Specifiers search contract and enforce their absence in tests
  • add responsive Chromium coverage with horizontal-overflow checks and serious/critical WCAG A/AA axe scanning
  • fix all nine review threads: contrast, canonical routing, duplicate/contradictory selection state, clinical applicability filtering, diagnostic ordering, base/specifier compatibility, and severe psychotic-features wording
  • synchronize safely with current main and preserve both review-ledger histories

Why

The supplied Formulation references needed to be reinterpreted for psychiatric specifiers while retaining the Database application's native shell, density, responsive behavior, and clinical decision-support conventions.

Areas touched

  • src/app/specifiers/** and src/components/specifiers/**
  • shared app-mode, sidebar, search-header, and mode-action integration
  • local static Specifiers catalogue/search model
  • Playwright and Vitest coverage
  • site-map, codebase documentation, and review ledger

Verification

  • final hosted CI on 65d8f533f: build, static checks, lint, typecheck, unit coverage, safety/config, critical UI, full UI regression, advisory UI, Semgrep, Gitleaks, GitGuardian, and PR required
  • npm run verify:pr-local — passed on the feature head: format, lint, TypeScript, 2,213 passed / 1 skipped, production build, and client-bundle secret scan
  • npm run verify:cheap — passed during review follow-up: runtime/action/sitemap/brand/scale checks, lint, typecheck, 2,214 passed / 1 skipped
  • focused catalogue Vitest — 6/6 passed for normalization and diagnosis/episode compatibility
  • focused Chromium — routing/menu, diagnostic ordering, compatibility blocking, and psychotic-features severity journeys passed
  • desktop/mobile Specifiers coverage — axe WCAG A/AA serious/critical scanning and overflow checks passed
  • targeted Prettier and git diff --check
  • non-CI npm run check:production-readiness — failed closed because this isolated worktree has no Supabase/OpenAI secrets; the CI-safe production-readiness check passed
  • provider-backed Supabase/OpenAI/live-data checks — not run; this change does not call those providers

Clinical Governance Preflight

  • Source-backed claims still require linked source verification before clinical use; the UI retains explicit review guidance
  • No patient-identifiable document workflow was introduced or expanded
  • Supabase target remains Clinical KB Database (sjrfecxgysukkwxsowpy)
  • Service-role keys and private document access were not changed
  • Demo/synthetic content remains separated from real clinical sources
  • Source metadata behavior remains unchanged; Specifiers is an original static catalogue and intentionally has no search provenance fields
  • Deployment classification/TGA SaMD impact needs product/governance-owner confirmation before treating the new wording support as production clinical guidance

Risk and follow-up

The catalogue contains original static decision-support summaries and does not change APIs, Supabase, ingestion, RAG retrieval, or answer generation. The builder now blocks diagnosis-incompatible combinations and preserves required severity wording, but a clinician should still verify wording against the current diagnostic manual and local documentation policy before clinical use. All nine actionable review threads are fixed and resolved.

BigSimmo added 2 commits July 14, 2026 05:16
Integrate Specifiers with the shared Clinical Guide shell, add local natural-language search and structured comparison/builder/map workflows, and cover desktop/mobile accessibility without source provenance fields.
@supabase

supabase Bot commented Jul 13, 2026

Copy link
Copy Markdown

This pull request has been ignored for the connected project sjrfecxgysukkwxsowpy because there are no changes detected in supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

@coderabbitai

coderabbitai Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Adds a new Specifiers app mode with a psychiatric specifier catalogue, ranked search, detail pages, builder, comparison, map, global navigation, generated sitemap entries, and unit/UI test coverage.

Changes

Specifiers mode

Layer / File(s) Summary
Specifier domain and mode contract
src/lib/app-modes.ts, src/lib/app-mode-icons.ts, src/lib/specifiers.ts, tests/app-modes.test.ts, tests/specifiers.test.ts
Defines the specifier catalogue, search/filtering helpers, related-record lookup, app-mode registration, icon mapping, and contract tests.
Specifier routes and shared home UI
src/app/specifiers/..., src/components/specifiers/specifier-ui.tsx, src/components/specifiers/specifiers-home-page.tsx
Adds route handlers, static detail generation, shared page primitives, landing content, query-driven search results, filters, and safety notes.
Builder, comparison, map, and detail workflows
src/components/specifiers/specifier-builder-page.tsx, src/components/specifiers/specifier-compare-page.tsx, src/components/specifiers/specifier-map-page.tsx, src/components/specifiers/specifier-record-page.tsx
Adds diagnostic wording construction, distinct-record comparison, family navigation, detailed record guidance, and related links.
Global navigation and test integration
src/app/page.tsx, src/components/clinical-dashboard/*, playwright.config.ts, tests/ui-specifiers.spec.ts, tests/ui-smoke.spec.ts
Connects specifiers to navigation and search actions, handles standalone routing and redirects, updates test discovery, and adds browser/accessibility coverage.
Sitemap generation and documentation
scripts/generate-site-map.ts, docs/site-map.md, docs/codebase-index.md, docs/branch-review-ledger.md
Adds specifier routes, ownership mappings, slug inventories, mode guidance, index entries, and review records.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant GlobalSearch
  participant SpecifiersRoute
  participant SpecifiersHome
  participant SpecifierCatalogue
  User->>GlobalSearch: select specifiers mode
  GlobalSearch->>SpecifiersRoute: navigate with query and run parameters
  SpecifiersRoute->>SpecifiersHome: pass normalized search state
  SpecifiersHome->>SpecifierCatalogue: searchSpecifiers(query, filters)
  SpecifierCatalogue-->>SpecifiersHome: ranked records
  SpecifiersHome-->>User: render filtered specifier results
Loading

Possibly related PRs

Suggested reviewers: copilot

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title is concise and accurately reflects the main change: adding a new specifiers decision-support workspace.
Description check ✅ Passed The description mostly matches the template and covers Summary, Verification, Clinical Governance Preflight, and follow-up notes.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/specifiers-design

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c9d8edf85f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/components/specifiers/specifier-builder-page.tsx Outdated
Comment thread src/lib/specifiers.ts Outdated
@BigSimmo

Copy link
Copy Markdown
Owner Author

@codex resolve actionable Codex review findings for this pull request and current head using the repository instructions. This is the pull request's single automatic repair pass: do not perform a fresh review, create new standalone findings, or request another review. Work only the existing unresolved Codex threads on the current head. Always fix P0 and P1 findings. For P2 and lower findings, fix only clear, scoped, low-risk issues; otherwise disposition them with a concise reason. After fixing or dispositioning a thread, reply in that thread with as the first line, followed by a concise summary; that marker authorizes the workflow to close that exact thread. If human input or new authorization is required, do not use the marker and leave the thread open with the blocker. Finish only after every actionable thread is fixed or dispositioned and closed, or explicitly left open for a human decision. Do not update the branch from main, address unrelated reviews, broaden scope, or create more than one scoped fix commit. Do not use external APIs, paid services, credentials, dependency changes, or broad refactors unless explicitly authorized. Add targeted tests where behavior changes and run the narrowest relevant validation.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c9d8edf85f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/lib/app-modes.ts

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/app/specifiers/builder/page.tsx`:
- Around line 9-13: Deduplicate the query values when constructing
initialSpecifiers from params.specifier, preserving the existing handling of
scalar values and empty input. Ensure repeated specifiers cannot enter the
builder’s selected state or create duplicate downstream keys.

In `@src/components/specifiers/specifier-builder-page.tsx`:
- Around line 30-33: Normalize validInitial before passing it to the selected
state in SpecifierBuilderPage, applying the same choose-up-to-one behavior used
by toggle() for the severity-remission category. Preserve other valid specifiers
and ensure at most one severity-remission slug is initially selected.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 55032f95-9e5e-4338-bdeb-3fcebd8ff203

📥 Commits

Reviewing files that changed from the base of the PR and between 3737598 and c9d8edf.

📒 Files selected for processing (27)
  • docs/branch-review-ledger.md
  • docs/codebase-index.md
  • docs/site-map.md
  • playwright.config.ts
  • scripts/generate-site-map.ts
  • src/app/specifiers/[slug]/page.tsx
  • src/app/specifiers/builder/page.tsx
  • src/app/specifiers/compare/page.tsx
  • src/app/specifiers/layout.tsx
  • src/app/specifiers/map/page.tsx
  • src/app/specifiers/page.tsx
  • src/components/clinical-dashboard/ClinicalSidebar.tsx
  • src/components/clinical-dashboard/global-search-shell.tsx
  • src/components/clinical-dashboard/master-search-header.tsx
  • src/components/clinical-dashboard/mode-action-popup.tsx
  • src/components/specifiers/specifier-builder-page.tsx
  • src/components/specifiers/specifier-compare-page.tsx
  • src/components/specifiers/specifier-map-page.tsx
  • src/components/specifiers/specifier-record-page.tsx
  • src/components/specifiers/specifier-ui.tsx
  • src/components/specifiers/specifiers-home-page.tsx
  • src/lib/app-mode-icons.ts
  • src/lib/app-modes.ts
  • src/lib/specifiers.ts
  • tests/app-modes.test.ts
  • tests/specifiers.test.ts
  • tests/ui-specifiers.spec.ts

Comment thread src/app/specifiers/builder/page.tsx
Comment thread src/components/specifiers/specifier-builder-page.tsx
@github-actions

Copy link
Copy Markdown

CI triage

CI failed on this PR. Automated classification of the 2 failed job(s):

  • UI regressionpossible known flake: UI/Playwright job; check tests/flake-ledger.json (tests/ui-smoke.spec.ts, tests/ui-smoke.spec.ts, tests/ui-tools.spec.ts, tests/ui-tools.spec.ts) and re-run before bisecting.
  • PR requiredpossible known flake: UI/Playwright job; check tests/flake-ledger.json (tests/ui-smoke.spec.ts, tests/ui-smoke.spec.ts, tests/ui-tools.spec.ts, tests/ui-tools.spec.ts) and re-run before bisecting.

Heuristic only — a main-side or flake label is a starting point, not a verdict.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bb660bd5b4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/components/specifiers/specifier-builder-page.tsx Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b9491a4420

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/components/specifiers/specifier-builder-page.tsx Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7f1d211f92

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/components/specifiers/specifier-builder-page.tsx Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 03daca3bfd

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/components/specifiers/specifier-builder-page.tsx Outdated
@BigSimmo
BigSimmo merged commit ac48de2 into main Jul 13, 2026
24 checks passed

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
src/lib/specifiers.ts (1)

635-661: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Consolidate the parallel diagnosis mapping tables to avoid drift.

diagnosisFiltersByApplicability, builderDiagnosesByApplicability, and knownDiagnosisFilters are three independently-maintained structures keyed by/derived from the same appliesTo strings and the same four diagnosis tokens (depressive, bipolar, psychotic, mood). Adding a new appliesTo category or diagnosis token later requires updating all three in lockstep; missing one silently degrades diagnosis filtering (falls through to the substring fallback in matchesDiagnosisFilter) or breaks builder applicability, with no compiler/test signal beyond the specific cases covered today.

Consider merging into a single table (e.g. applicabilityByCategory: Record<string, { searchDiagnoses: readonly string[]; builderDiagnoses: readonly SpecifierBuilderDiagnosis[] }>) and deriving knownDiagnosisFilters from the union of searchDiagnoses values, so there is one source of truth for this clinical mapping.

Also applies to: 667-667

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/lib/specifiers.ts` around lines 635 - 661, Consolidate
diagnosisFiltersByApplicability and builderDiagnosesByApplicability into one
applicabilityByCategory mapping keyed by the shared appliesTo categories, with
searchDiagnoses and builderDiagnoses fields. Update the lookup logic to use this
combined table, and derive knownDiagnosisFilters from the union of all
searchDiagnoses values instead of maintaining a separate list. Preserve existing
mappings and fallback behavior for unmatched categories.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@src/lib/specifiers.ts`:
- Around line 635-661: Consolidate diagnosisFiltersByApplicability and
builderDiagnosesByApplicability into one applicabilityByCategory mapping keyed
by the shared appliesTo categories, with searchDiagnoses and builderDiagnoses
fields. Update the lookup logic to use this combined table, and derive
knownDiagnosisFilters from the union of all searchDiagnoses values instead of
maintaining a separate list. Preserve existing mappings and fallback behavior
for unmatched categories.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 9ce3811e-e8dd-4740-80cc-18328753756b

📥 Commits

Reviewing files that changed from the base of the PR and between c9d8edf and 65d8f53.

📒 Files selected for processing (8)
  • docs/branch-review-ledger.md
  • src/app/page.tsx
  • src/app/specifiers/builder/page.tsx
  • src/components/specifiers/specifier-builder-page.tsx
  • src/lib/specifiers.ts
  • tests/specifiers.test.ts
  • tests/ui-smoke.spec.ts
  • tests/ui-specifiers.spec.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/app/specifiers/builder/page.tsx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant